package nimble.unionpay.openapi;

import org.apache.commons.lang3.StringUtils;

public enum CardBrand {


    CUP_CARD_9("11","9字头银联卡"),
    CUP_CARD_62("12","62银联标准卡"),
    CUP_CARD_OTHER("13","其他银联标准卡（视同）"),
    CUP_VISA_CARD("01","VISA卡（VIS）银联标识卡"),
    CUP_MASTER_CARD("02","万事达卡（MCC）银联标识卡"),
    CUP_MAE_CARD ("03","万事顺卡（MAE）银联标识卡"),
    CUP_JCB_CARD("04","JCB卡（JCB）银联标识卡"),
    CUP_DC_CARD("05","大莱卡（DinnerClub）银联标识卡"),
    CUP_AMEX_CARD("06","运通卡（AMX）银联标识卡"),
    CUP_OTHER_CARD("07","其他银联标识卡"),
    OTHER_CARD("99","其他");


    private String code;
    private String desc;

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    CardBrand(String code,String desc)
    {
        this.code=code;
        this.desc=desc;
    }

    public static CardBrand parse(String code)
    {
        for(CardBrand cardBrand:CardBrand.values())
        {
            if(StringUtils.equalsAny(code,cardBrand.name(),cardBrand.getCode()))
            {
                return cardBrand;
            }
        }
        return null;
    }
}
